package com.hopu.oa.controller.daymanage;

import com.hopu.oa.entity.daymanage.AoaScheduleList;
import com.hopu.oa.entity.user.AoaUser;
import com.hopu.oa.service.daymanage.MyCalendarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * @ClassName: MyCalendar
 * @Description:
 * @Date: 2021/11/25 19:08
 */
@Controller
public class MyCalendar {


    @Autowired
    MyCalendarService myCalendarService;

    @RequestMapping("/daycalendar")
    public String daycalendar(Model model, HttpServletRequest request) {
        return "daymanage/daycalendar";
    }

    @ResponseBody
    @RequestMapping("/mycalendarload")
    public List<AoaScheduleList> mycalendarload(HttpSession session) {
        AoaUser user = (AoaUser) session.getAttribute("user");
        Integer userId = user.getUserId();
        List<AoaScheduleList> aoaScheduleList = myCalendarService.scheduleList(userId);
        return aoaScheduleList;
    }

}